package ControlLayer;
import java.util.ArrayList;
import ModelLayer.*;
//model layer package has to be imported
/**
 * Controller class for the DVD collection
 * 
 * @author (kbh) 
 * @version (2005.03.31)
 * @revised version English (Ab)
 * (FEN): 2006.03.21: Some changes to the architecture in order to assure layering
 *                    and loose coupling
 */
public class DVDCtr
{
    //declare instance variables to reference containers
    private DVDContainer dvdContainer;

    /**
     * Constructor for objects of class DVDCtr
     */
    public DVDCtr()
    {
        //set up references to containers
        dvdContainer = DVDContainer.getInstance();
    }
    
 //     public DVD findDVD(long dvdId)
 //     {
 //         return dvdContainer.getDvd(dvdId); 
 //     }
    
    private DVD createDVD(String title, String aquireDate, double aquirePrice)
    {
        return new DVD(title, aquireDate, aquirePrice);
    }
    
    public void addDVD(String title, String acquireDate, double acquirePrice)
    {
        dvdContainer.addDvd(createDVD(title, acquireDate, acquirePrice));
    }
    
    public void deleteDVD(int dvdId)
    {
        //search for the dvd and delete the object from the container
        dvdContainer.removeDvd(dvdId);
    }    
    
    public ArrayList<DVD> listAllDvds()
    {
        //returns a list of all dvds and their associated copies
        return dvdContainer.getDvds();
    }
    
    public void changeTitle(int dvdId, String title)
    {
        dvdContainer.changeTitle(dvdId, title);
    }
    
    public void changeAquireDate(int dvdId, String aquireDate)
    {
        dvdContainer.changeAquireDate(dvdId, aquireDate);
    }
    
    public void changeAquirePrice(int dvdId, double aquirePrice)
    {
        dvdContainer.changeAquirePrice(dvdId, aquirePrice);
    }
    
    public void printInfo(int dvdId)
    {
        dvdContainer.printInfo(dvdId);
    }
    
    public void printAllDvdInfo()
    {
        dvdContainer.printAllDvdInfo();
    }
}
